package com.parthmehrotra.Martial_Arts_Scorekeeper;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.parth.Martial_Arts_ScoreKeeper.R;
import com.viewpagerindicator.TabPageIndicator;

/**
 * Author: parthmehrotra
 * Date: 6/21/13
 * Time: 5:29 PM
 */
public class ChooseMartialArt extends SherlockFragmentActivity {
    private static final String[] CONTENT = new String[]{"TKD", "BJJ", "TPM"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ma_choose);

        FragmentPagerAdapter adapter = new MartialArtsAdapter(getSupportFragmentManager());

        ViewPager pager = (ViewPager) findViewById(R.id.pager);
        pager.setAdapter(adapter);

        TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.idicator);
        indicator.setViewPager(pager);
    }

    class MartialArtsAdapter extends FragmentPagerAdapter {
        public MartialArtsAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int i) {
            return TestFragment.newInstance(CONTENT[i]);
        }

        @Override
        public int getCount() {
            return CONTENT.length;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return CONTENT[position].toUpperCase();
        }
    }

}
